home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
comm
/
misc
/
xpr_2_0.lha
/
Sources
/
xprasciifunky.asm
< prev
next >
Wrap
Assembly Source File
|
1989-03-10
|
2KB
|
89 lines
;;; funky.asm
;
; DESCRIPTION:
; ===========
;
; Initial startup routine for Aztec C.
; Copyright (C) 1986 by Manx Software Systems, Inc.
;
; But FUNKIFIED by Jim Mackraz.
;
;;;
; library base in D0
; segment list in A0
; execbase in A6
; NOTE: code down to "start" must be placed at beginning of
; all programs linked with Aztec Linker using small
; code or small data.
a4save dc.l 0
public .begin ; just to resolve label
.begin
public _funkyInit
_funkyInit:
near code
movem.l d0/d2/d3/d4-d7/a2-a6,-(sp)
; FUNKY use a0, not a1 for segment list
move.l a0,a4 ;BPTR to code seg
add.l a4,a4
add.l a4,a4 ;now real address of code seg
move.l (a4),a4 ;indirect to get data segment BPTR
add.l a4,a4 ;convert to real pointer
add.l a4,a4 ;real address of data seg link field
; same as crt0.a68
add.l #32766+4,a4 ;bias appropriately (+4 is for link)
lea __H1_end,a1
lea __H2_org,a2
cmp.l a1,a2 ;check if BSS and DATA together
bne start ;no, don't have to clear
move.w #((__H2_end-__H2_org)/4)-1,d1
bmi start ;skip if no bss
move.l #0,d2
loop
move.l d2,(a1)+ ;clear out memory
dbra d1,loop
start
lea a4save,a1 ;get address of a4save
move.l a4,(a1) ;save a4
; FUNKY
; move.l sp,__savsp ;save stack pointer (can't fexec)
; move.l 4,a6 ;get Exec's library base pointer
move.l a6,_SysBase ;put where we can get it
movem.l d0/a0,-(sp) ; pass base and seglist
jsr _funkymain ; FUNKY
addq.l #8,sp ;pop args to funkymain()
; can pop better (?)
movem.l (sp)+,d0/d2/d3/d4-d7/a2-a6
rts ;and return
public _geta4
_geta4:
move.l a4save,a4
rts
dseg
_SysBase dc.l 0
public _funkymain
public _SysBase
public __H1_end,__H2_org,__H2_end
end